package org.huatek.anders.service;

import com.alibaba.dubbo.config.annotation.Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author anders
 * @date 2018-11-14 14:43
 * 将消息发送至默认的交换机且routingKey为notify.payment
 **/
@Component
@Service
@Slf4j
public class PaymentNotifySenderServiceImpl implements PaymentNotifySenderService {
    private final RabbitTemplate rabbitTemplate;
    @Autowired
    public PaymentNotifySenderServiceImpl(RabbitTemplate rabbitTemplate){
        this.rabbitTemplate = rabbitTemplate;
    }
    @Override
    public void sender(String msg) {
        log.info("notify.payment send message: "+msg);
        rabbitTemplate.convertAndSend("notify.payment", msg);
    }
}
